package com.bright.hxj.qchz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bright.ghj.common.util.ListUtil;
import com.bright.hxj.qchz.mapper.DuijieJieshouMainkeyMapper;
import com.bright.hxj.qchz.pojo.po.Duijie_ShiJieShou_Mainkey;
import com.bright.hxj.qchz.service.Duijie_ShiJieShouMainKeyManager;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
@RequiredArgsConstructor
public class Duijie_ShiJieShouMainKeyManagerImpl implements Duijie_ShiJieShouMainKeyManager {

    private final DuijieJieshouMainkeyMapper mainkeyMapper;

    @Override
    public List<String> getColumns() {
//        List<String> rvalue = new ArrayList<String>();

//        String sql = "SELECT columnName FROM Duijie_JieShou_MainKey WHERE visible=1 ORDER BY disId";

//        List<List<Object>> data = duijie_shiJieShou_jdbcTemplate.queryForListList(sql);
//        for(List<Object> dataSub: data) {
//            rvalue.add(((String) dataSub.get(0)).toUpperCase());
//        }

        List<Duijie_ShiJieShou_Mainkey> mainKeys = mainkeyMapper.selectList(new LambdaQueryWrapper<Duijie_ShiJieShou_Mainkey>()
                .eq(Duijie_ShiJieShou_Mainkey::getVisible, true)
                .orderByAsc(Duijie_ShiJieShou_Mainkey::getDisId));

        return ListUtil.toSingleList(mainKeys, Duijie_ShiJieShou_Mainkey::getColumnName);
    }
}
